<template>
  <div>
    <div class="overlay" v-if="show">
      <div class="confirmation-dialog">
        <h3 class="confirmation-title">{{ title }}</h3>
        <p class="confirmation-message">{{ message }}</p>
        <div class="confirmation-buttons">
          <button class="confirmation-button cancel-button" @click="cancel">取消</button>
          <button class="confirmation-button confirm-button" @click="confirm">确认</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ConfirmationDialog',
  props: {
    title: {
      type: String,
      required: true
    },
    message: {
      type: String,
      required: true
    },
    confirmButtonText: {
      type: String,
      default: '确认'
    },
    cancelButtonText: {
      type: String,
      default: '取消'
    },
    show: {
      type: Boolean,
      required: true
    }
  },
  methods: {
    cancel () {
      this.$emit('cancel')
    },
    confirm () {
      this.$emit('confirm')
    }
  }
}
</script>

<style scoped>
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.confirmation-dialog {
  position: relative;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  width: 350px;
  padding: 20px;
}

.confirmation-title {
  margin: 0;
  font-size: 20px;
}

.confirmation-message {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
}

.confirmation-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.confirmation-button {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-size: 16px;
  margin-left: 10px;
  font-weight: 400;
}

.cancel-button {
  background-color: #fff;
  color: #333;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.confirm-button {
  background-color: #1976d2;
  color: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
</style>
